import 'package:cloudbase_core/cloudbase_core.dart';
class CartModel {
  List<CartModelData> data;
  String code;
  String message;
  String requestId;

  CartModel({this.data, this.code, this.message, this.requestId});

  CartModel.fromJson(CloudBaseResponse json) {
    if (json.data != null) {
      data = <CartModelData>[];
      json.data.forEach((v) {
        data.add(new CartModelData.fromJson(v));
      });
    }
    code = json.code;
    message = json.message;
    requestId = json.requestId;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data.map((v) => v.toJson()).toList();
    }
    data['code'] = this.code;
    data['message'] = this.message;
    data['requestId'] = this.requestId;
    return data;
  }
}

class CartModelData {
  String sId;
  int iCreateTime;
  String sOpenid;
  int iUpdateTime;
  int count;
  String goodsId;
  List<ShoesInfo> shoesInfo;

  CartModelData(
      {this.sId,
      this.iCreateTime,
      this.sOpenid,
      this.iUpdateTime,
      this.count,
      this.goodsId,
      this.shoesInfo});

  CartModelData.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    iCreateTime = json['_createTime'];
    sOpenid = json['_openid'];
    iUpdateTime = json['_updateTime'];
    count = json['count'];
    goodsId = json['goods_id'];
    if (json['shoes_info'] != null) {
      shoesInfo = <ShoesInfo>[];
      json['shoes_info'].forEach((v) {
        shoesInfo.add(new ShoesInfo.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['_id'] = this.sId;
    data['_createTime'] = this.iCreateTime;
    data['_openid'] = this.sOpenid;
    data['_updateTime'] = this.iUpdateTime;
    data['count'] = this.count;
    data['goods_id'] = this.goodsId;
    if (this.shoesInfo != null) {
      data['shoes_info'] = this.shoesInfo.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class ShoesInfo {
  String sId;
  String brand;
  String content;
  List<String> imgs;
  double price;
  String title;
  int iCreateTime;
  int iUpdateTime;
  String color;

  ShoesInfo(
      {this.sId,
      this.brand,
      this.content,
      this.imgs,
      this.price,
      this.title,
      this.iCreateTime,
      this.iUpdateTime,
      this.color});

  ShoesInfo.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    brand = json['brand'];
    content = json['content'];
    imgs = json['imgs'].cast<String>();
    price = double.parse(json['price'].toString());
    title = json['title'];
    iCreateTime = json['_createTime'];
    iUpdateTime = json['_updateTime'];
    color = json['color'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['_id'] = this.sId;
    data['brand'] = this.brand;
    data['content'] = this.content;
    data['imgs'] = this.imgs;
    data['price'] = this.price;
    data['title'] = this.title;
    data['_createTime'] = this.iCreateTime;
    data['_updateTime'] = this.iUpdateTime;
    data['color'] = this.color;
    return data;
  }
}
